<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<% String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>包租婆投诉</title>
 <link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"> 
<style type="text/css">
	#showPort{
		padding-top:60px;
		width:900px;
		height:80px;
		margin:0 auto;
	}
	#td1{
		width:200px;
	}
	#td2{
		width:200px;
	}
	#td4{
		width:60px;
	}
	#BtnDiv{
		padding-top:200px;
		width:180px;
		margin:0 auto;
	}
	#table{
	width: 900px;
	}
	td{
	text-align: center;
	}
</style>
</head>
<body>
	<div>
		<div id="showPort">
			<table id="table" class="table table-bordered">
				<tr>
					<td id="td1">投诉方</td>
					<td id="td2">被投诉方</td>
					<td style="width: 200px">投诉时间</td>
					<td id="td4">操作</td>
				</tr>
			</table>
		</div>
		<div id="BtnDiv">
				<input type="button" id="UpBtn" onclick="pageUp()" class="btn btn-info" value="上一页">
				<label><span id="page">1</span>/<span id="count"></span></label>
				<input type="button" id="DownBtn" onclick="pageDown()" class="btn btn-info" value="下一页">
		</div>
	</div>
	<script type="text/javascript" src="../../js/jquery-3.1.0.min.js"></script>
	<script type="text/javascript">
	var count=0;
	fenye();
	function fenye(){
	var page=$("#page").html();
	$.ajax({
		   type: "POST",
		   url: "../../showLandlady.do",
		   data:{"page":page},
		   success: function(msg){
			   var page=$("#page").html();
			   count=msg[msg.length-1];
			   var table="";
			   for(var i=0;i<msg.length-1;i++){
				   table=table+"<tr><td>"+msg[i][1]+"</td><td>"+msg[i][2]+"</td><td>"+new Date(msg[i][3]).toLocaleDateString()+"</td><td><input type='button' onclick=sendID("+msg[i][0]+") value='受理' class='btn btn-warning'/></td></tr>"
			   }
			   if(count==0){
				   $("#page").html(0);  
			   }
		     $("#table").append(table);
		     $("#page").html();
		     $("#count").html(count);
		   }
		});
	};

	function pageUp(){
		var page=$("#page").html();
		var num=new Number(page);
		if(num<=1){
			$("#page").html(1);
		}else{
		$("#page").html(page=--num);
		}
		$('#table tr:gt(0)').remove();
		
		fenye();
	};
	
	function pageDown(){
		var page=$("#page").html();
		var num=new Number(page);
		if(num<count){
			$("#page").html(++num);
		}else{
			$("#page").html(count);
		}
		$('#table tr:gt(0)').remove();
		fenye();
	};
	function sendID(cmpID){
		window.location.href="handLandladyComplaint.jsp?complaintRecordID="+cmpID;
	}
	</script>
</body>
</html>